// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLObjectImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "SQLAlterTableDropPartition.h"
#include "../../visitor/SQLASTVisitor.h"
#include "../SQLExpr.h"
#include "../../../utils/listTran.h"

SQLAlterTableDropPartition::SQLAlterTableDropPartition()
{
  partitions = std::make_shared<std::list<SQLExpr_ptr>>();
}
SQLExpr_list_ptr SQLAlterTableDropPartition::getPartitions()
{
  return partitions;
}

void SQLAlterTableDropPartition::addPartition(SQLExpr_ptr partition)
{
  if (partition != nullptr)
  {
    partition->setParent(SharedObject(SQLAlterTableDropPartition));
  }
  this->partitions->push_back(partition);
}

BOOL_ptr SQLAlterTableDropPartition::isIfExists()
{
  return ifExists;
}

void SQLAlterTableDropPartition::setIfExists(BOOL_ptr ifExists)
{
  this->ifExists = ifExists;
}

BOOL_ptr SQLAlterTableDropPartition::isPurge()
{
  return purge;
}

void SQLAlterTableDropPartition::setPurge(BOOL_ptr purge)
{
  this->purge = purge;
}

// @Override
void SQLAlterTableDropPartition::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLAlterTableDropPartition)))
  {
    SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLExpr, SQLObject>(partitions);
    acceptChild(visitor, tmp1);
  }
  visitor->endVisit(SharedObject(SQLAlterTableDropPartition));
}
